They obviously will render differently and the output page looks different because of the newly placed &. I was hoping to get the output to be "exactly" the same.
Thanks much
This is because the HTML parser used is not compatible with the parsers found in browsers; you could try using html5lib (http://code.google.com/p/html5lib/downloads/detail?name=html5lib-php-0.1.tar.gz) to get a DOM, though.
The original original html source code is slightly inaccurate (semicolons missed).